#ifndef MRFS_CONFERENCE_MESSAGE_H
#define MRFS_CONFERENCE_MESSAGE_H

#include <memory>
#include <vector>

#include "FastJsoncpp.h"
#include "SerializableObject.h"
#include "json/value.h"


class MrfsConferenceMessage : public SerializableObject
{
    SERIALIZABLE_OBJECT_D(MrfsConferenceMessage)
   public:
    using Ptr = std::shared_ptr<MrfsConferenceMessage>;
    MrfsConferenceMessage();

    class Target{
    public:
        std::string _memberId;
        std::string _type;
    };

    friend std::ostream& operator<<(std::ostream& os, const MrfsConferenceMessage::Ptr& obj)
    {

        if (!obj)
        {
            return os << "conferenceRoom{nullptr}";
        }
        os << obj->_event << "{confResourceId=" << obj->_id
           << ", event=" << obj->_event;

        if (obj->_hasTarget){
            os << ", target{memberId=" << obj->_target._memberId << ", type=" << obj->_target._type << "}";
        }
        os << "}";
        return os;
    }

   public:
    virtual bool _parse(const Json::Value& message) { 
        return true;
    };
    const std::string& getConfResourceId() const;

    const std::string& getEvent() const;

    const std::string& getMemberId() const;

    const std::string& getType() const;

    const Target& getTarget() const;

    const Json::Value& getOrigRequestData() const;


   protected:
    std::string _id;      // 会议资源Id
    std::string _event;   // 事件类型
    Target      _target;
    Json::Value _origJson;
    bool        _hasTarget{false};
};

#endif
